<?php

/**
 * ScratchCard form base class.
 *
 * @method ScratchCard getObject() Returns the current form's model object
 *
 * @package    Amman to London
 * @subpackage form
 * @author     Adel Abu-Saif <adeljas@msn.com>
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseScratchCardForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'          => new sfWidgetFormInputHidden(),
      'card_number' => new sfWidgetFormInputText(),
      'value'       => new sfWidgetFormChoice(array('choices' => array(8 => 8, 10 => 10))),
      'created_at'  => new sfWidgetFormInputText(),
      'is_deleted'  => new sfWidgetFormInputCheckbox(),
      'charged_at'  => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'id'          => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'card_number' => new sfValidatorPass(array('required' => false)),
      'value'       => new sfValidatorChoice(array('choices' => array(0 => 8, 1 => 10), 'required' => false)),
      'created_at'  => new sfValidatorPass(array('required' => false)),
      'is_deleted'  => new sfValidatorBoolean(array('required' => false)),
      'charged_at'  => new sfValidatorPass(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('scratch_card[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'ScratchCard';
  }

}
